package acm.力扣391周赛;

import org.junit.Test;

//https://leetcode.cn/contest/weekly-contest-391/problems/water-bottles-ii/
public class 换水问题2 {
    public int maxBottlesDrunk(int n, int ex) {
        int empty=0;
        int res=0;
        while (n>0){
            res+=n;
            empty+=n;
            n=0;
            while (empty>=ex){
                empty-=ex;
                n++;
                ex++;
            }
        }
        return res;
    }
    @Test
    public void test(){
        int res = maxBottlesDrunk(10, 3);
        System.out.println(res);
    }
}
